package com.example.mapp;

import com.example.entity.PointDefend;
import com.example.entity.PointFlow;
import com.example.entity.authority.SystemUser;
import com.example.mapp.buildSql.PointDefendMappSql;
import com.example.mapp.buildSql.PointFlowMappSql;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * 实施对象
 */
@Mapper
public interface PointFlowMapp {

    //通过id查询SQL语句
    @SelectProvider(type = PointFlowMappSql.class, method = "findList")
    public List<PointFlow> findList(PointFlow pointFlow);

    @Insert("insert into point_flow (operation_type,operation_content,user_name,party_name,identification,mark,create_by,create_date,function,extend_field) values (#{operationType},#{operationContent},#{userName},#{partyName},#{identification},#{mark},#{createBy},#{createDate},#{function},#{extendField})")
    int insertPointFlow(PointFlow pointFlow);

    /**
     * 根据partyId 获取单位信息
     * @param id
     * @return
     */
    @SelectProvider(type = PointFlowMappSql.class, method = "findUserInfo")
    Map<String, Object> findUserInfo(Long id);

    /**
     * 根据userId 获取用户信息
     * @param id
     * @return
     */
    @SelectProvider(type = PointFlowMappSql.class, method = "findUserInfoByUserId")
    Map<String, Object> findUserInfoByUserId(Long id);

    @Update("update sys_user set mark =#{round} where id=#{userId}")
    int updateMark(@Param("round") Integer round,@Param("userId") String userId);

    @SelectProvider(type = PointFlowMappSql.class, method = "findOne")
    List<PointFlow> findOne(PointFlow pointFlow);
    /**
     * 根据userId 获取用户信息获取系统管理员信息
     * @param userId
     * @return
     */
    @SelectProvider(type = PointFlowMappSql.class, method = "getAdminInfoByUserId")
    Map<String, Object> getAdminInfoByUserId(Long userId);
}
